﻿
-- ================================================
-- Remarks: Not part of standard Stored Proc
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_Person_GetByPrimaryEmailId')
	BEGIN
		DROP  Procedure  Ivy_Person_GetByPrimaryEmailId
	END

GO

CREATE PROCEDURE [Ivy_Person_GetByPrimaryEmailId] 
-- =============================================
-- Author:		<Ram pravesh kr>
-- Create date: <31/05/2016>
-- Description:	<Ivy_Person_GetByPrimaryEmailId>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@PersonPrimaryEmailID varchar(200)
			
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT	[PersonKey],
	        [PersonFirstName] ,
			[PersonLastName] ,
			[PersonSex] ,
			[PersonDateOfBirth],
			[PersonPrimaryEmailID],
			[PersonPrimaryEmailVerificationCode],
			[PersonPrimaryEmailIsVerified],
			[PersonAlternateEmailID],
			[PersonPrimaryMobileNumber],
			[PersonPrimaryMobileVerificationCode],
			[PersonPrimaryMobileIsVerified],
			[PersonAlternatePhoneNumber],
			[PersonAddressLine1],
			[PersonAddressLine2],
			[PersonAddressCityName],
			[PersonAddressStateName],
			[PersonAddressCountryName],
			[PersonAddressPinZipCode],

			[Sys_DateOfCreation],
			[Sys_DateOfModification],
			[Sys_CreatedByID],
			[Sys_ModifiedByID],
			[Sys_DeleteType],
			[Sys_IsDeleted],
			[Sys_OrganizationID],
			[Sys_InitialPrimaryKeys],
			[Sys_WorkstationName]
	FROM	[Person]
	WHERE		
		(
			[PersonPrimaryEmailID] = @PersonPrimaryEmailID 
		);
END
GO
